lib/pull: Properly remove temporary remotes
authorMatthew Leeds <matthew.leeds@endlessm.com>
Thu, 8 Feb 2018 22:13:45 +0000 (14:13 -0800)
committerAtomic Bot <atomic-devel@projectatomic.io>
Fri, 9 Feb 2018 22:30:51 +0000 (22:30 +0000)
commit5848de93a4346ad3c49d907ced7612578781f5e8
tree3385b52dc51b1955ac6fbf4b327eb02904f7bf51
parent88d27fb3f1bb4102fddc74e77276011f6ee365ec
lib/pull: Properly remove temporary remotes

For P2P pulls ostree adds temporary remotes and removes them in
find_remotes_cb(). However, if an OstreeRepoFinderResult gets freed
during the course of that function, the OstreeRemote in the result is
freed but a pointer to it remains in the remotes_to_remove array. This
means that when _ostree_repo_remove_remote() gets called on it at the
end of the function it will fail. In my case the resulting error was
"OSTree-CRITICAL **: _ostree_repo_remove_remote: assertion 'remote->name
!= NULL' failed" but I think it could also seg fault.

This commit adds a reference to the remote so it can be properly removed
when we're finished with it.

Closes: #1450
Approved by: giuseppe
src/libostree/ostree-repo-pull.c